计算机与现代化 ›› 2012, Vol. 1 ›› Issue (1): 49-52.doi: 10.3969/j.issn.1006-2475.2012.01.013

• 软件工程 • 上一篇    下一篇

基于遗传算法的测试用例自动生成及其改进方法

胡文欢,钱越英   

  1. 北京应用气象研究所,北京 100029
  • 收稿日期:2011-08-02 修回日期:1900-01-01 出版日期:2012-01-10 发布日期:2012-01-10

Test Cases Auto-generating Based on Genetic Algorithm and Its Improved Method

HU Wen-huan, QIAN Yue-ying   

  1. Beijing Institute of Applied Meteorology, Beijing 100029, China
  • Received:2011-08-02 Revised:1900-01-01 Online:2012-01-10 Published:2012-01-10

摘要: 遗传算法是一种通用的自适应搜索算法。它给测试用例自动生成问题带来了新的解决思路。但是传统的遗传算法应用于测试用例自动生成,重组、突变的随机性容易使种群中多样性遭到破坏,使得算法搜索空间减小,从而导致算法错误地收敛到局部最优值。而且盲目的随机重组和突变又使得搜索的效率非常低。本文介绍一种改进方法,引进突变控制策略和优化解控制策略,可有效提高遗传算法的搜索能力和获取最优解的性能。

关键词: 遗传算法, 测试用例, 突变控制策略, 优化解控制策略, 最优解

Abstract: Genetic algorithm is currently an adaptive searching algorithm which gives a new solution to generate test cases. However, when it is used to generate test cases, the randomness of recombination and mutation makes the diversity of the population easily destroyed and leads to the search space getting smaller, finally results in the algorithm finding a wrong local optimum. Moreover, recombining and mutating freely makes the searching efficiency very low. This paper introduces an improved method, with a mutation control strategy and an optimal control strategy added, which effectively improves the searching capability and gets optimal solution capability of the algorithm.

Key words: genetic algorithm, test case, mutation control strategy, optimal control strategy, optimal solution

中图分类号: